package kz.kstu.scantest.business.entity.data;

import kz.kstu.scantest.business.entity.CommonEntityConstant;
import kz.kstu.scantest.business.entity.Identifiable;
import kz.kstu.scantest.business.entity.data.FormData;

import javax.persistence.*;

/**
 * @author Filipp_Stankevich
 *         created: 08.09.11 17:32
 */

@NamedQuery(name = CommonEntityConstant.DELETE_FROM_DATA_ERRORS_BY_ID, query = "delete from FormDataError f where f.formData.id = :id")

@Entity
@Table(name = "FORM_DATA_ERROR")
public class FormDataError implements Identifiable {

    private Long id;
    private String description;
    private FormData formData;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "DESCRIPTION")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToOne
    @JoinColumn(name = "FORM_DATA_ID", referencedColumnName = "ID")
    public FormData getFormData() {
        return formData;
    }

    public void setFormData(FormData formData) {
        this.formData = formData;
    }
}
